/*
 * Lights out solver implementation
 */
#include "lib/lightsout_util.h"

int main(int argc, char* argv[]){
    //check arguments of cmd
    if(argc != 2){
        fprintf(stderr, "Usage: lightsout <board name>\n");
        return 1;
    }

    char *board_filename = argv[1];
    ba_ht_elem start = xmalloc(sizeof(struct ba_ht_elem_base));
    uint8_t width = 0;
	uint8_t height = 0;
    if (!file_read(board_filename, &(start->ba), &width, &height)) {
        free(start);
        fprintf(stderr, "Input file format wrong!\n");
        return 1;
    }
    if(is_solvable(width, height, start)){
        printf("Board is solvable!\n");
        return 0;
    }
    else{
        fprintf(stderr, "No solution was found!\n");
        return 1;
    }
}

